class editorMiddleware {
    constructor() {
        // coverage图层组件vue对象
        this.coverageVm = ''
        // 右键单击对象----地图
        this.rightClickData = ''
        // 右键单击对象----树形菜单
        this.rightClickNode = ''
        // 复制剪切图层对象
        this.copyShearobj = ''
        // 复制剪切对象
        this.copyShearData = ''
        // 新增标绘图层对象
        this.coverageMap = new Map()
        // 当前选择的树节点
        this.treeSelectData = ''
        // 当前添加点线面数据的父节点ID
        this.drawingId = ''
        // 图层树
        this.treeObj = ''
        // 是否飞图
        this.isFlyTo = true
        // 右键选中的树节点
        this.treeSelectNode = ''
        // 是否正在绘制
        this.isBeEditor = false
    }

    init(vue) {
        this.coverageVm = vue
    }

    addCoverageObj(data) {
        // console.log(data)
        // 给树形菜单添加子菜单
        // console.log(this.treeObj)
        let addData = {
            name: data.name,
            pid: this.drawingId,
            id: data.id,
            type: data.type,
            editor: true,
            show: true
        }
        this.treeObj.append(addData, this.treeSelectData)
        // 设置新添加子菜单为选中状态
        this.treeObj.setChecked(addData, true, false)
        // 展开当前子菜单的父级菜单
        // console.log(this.treeSelectData)
        // this.treeObj.getNode(this.treeSelectData.id).expanded = true
        this.treeSelectData.expanded = true
        // this.coverageVm.addCoverageObj(data)
    }
}
const editorware = new editorMiddleware()
export default editorware
